package cn.melonlib.apis.support.comp.config.impl;

import cn.melonlib.apis.support.comp.config.ApiRequestUserAgent;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

@Component
@ConditionalOnProperty(prefix = "apis.request",value = "user-agent",matchIfMissing = true,havingValue = "default")
public class DefaultApiRequestUserAgent implements ApiRequestUserAgent {

    @Value("${system.config.name:MelonLib}")
    private String systemName;

    @Value("${system.config.version:2.0}")
    private String systemVersion;

    @Value("${system.config.comment:extends MelonLib packages}")
    private String comment;
    @Override
    public String getUserAgent() {
        return systemName+" / "+systemVersion+" "+comment;
    }
}
